package com.kedou.sdk.params.bean;

/**
 * Created by Administrator on 2017/6/9 0009.
 */

public enum PayType {

    UNKNOWN(0),

    /**
     * 支付宝支付
     */
    ALIPAY_PAY(2),

    /**
     * 余额支付
     */
    BALANCE_PAY(3),

    /**
     * 微信支付
     */
    WEIXIN_PAY(5),

    /**
     * 银联支付
     */
    UNION_PAY(8),

    /**
     * 微信小程序支付
     */
    WEIXIN_APPLET_PAY(9),

    /**
     * 海外豪哥平台支付
     */
    HAOGE_PAY(10),

    /**
     * 海外PayPal支付
     */
    PAYPAL_PAY(11),

    /**
     * 乐云付支付
     */
    LEYUN_PAY(12),



    /**
     * 海外UnderLine支付
     */
    UNDER_LINE_PAY(13),


    /**
     * 微信app支付
     */
    WECHAT_APP_PAY(1),

    /**
     * 各种H5支付方式，默认启动外部浏览器
     */
    DEFAULT_WEB_BROWSER(15, 100),

    /**
     * 云闪付APP支付
     */
    UNION_APP_PAY(101),

    /**
     * 平台币支付
     */
    PLATFORMCOIN_PAY(200);


    private int startIndex;
    private int endIndex;

    PayType(int startIndex) {
        this(startIndex, startIndex);
    }

    PayType(int startIndex, int endIndex) {
        this.startIndex = startIndex;
        this.endIndex = endIndex;
    }

    public int getStartIndex() {
        return startIndex;
    }

    public int getEndIndex() {
        return endIndex;
    }

    public static PayType valueOf(int value){
        switch (value){
            case 2:
                return ALIPAY_PAY;

            case 3:
                return BALANCE_PAY;

            case 5:
                return WEIXIN_PAY;

            case 8:
                return UNION_PAY;

            case 9:
                return WEIXIN_APPLET_PAY;

            case 10:
                return HAOGE_PAY;

            case 11:
                return PAYPAL_PAY;

            case 12:
                return LEYUN_PAY;

            case 13:
                return UNDER_LINE_PAY;

            case 1:
                return WECHAT_APP_PAY;

            case 101:
                return UNION_APP_PAY;
            case 200:
                return PLATFORMCOIN_PAY;

            default:
                if(value >= 15 && value <= 100){
                    return DEFAULT_WEB_BROWSER;
                }
                return UNKNOWN;
        }
    }

}
